package de.jmda.gen.java.impl;

import static org.junit.Assert.assertTrue;

import org.apache.log4j.Logger;
import org.junit.Test;

import de.jmda.gen.Generator;
import de.jmda.gen.GeneratorException;

public class JUT_DefaultExtendsClauseGenerator
{
	private final static Logger LOGGER =
      Logger.getLogger(JUT_DefaultExtendsClauseGenerator.class);

	@Test
	public void testDefaultExtendsStatementGenerator()
			throws GeneratorException
	{
		Generator generator = new DefaultExtendsClauseGenerator();
		
		StringBuffer generated = generator.generate();

		LOGGER.debug("generated [" + generated + "]");

		assertTrue(
				"unexpected extends clause [" + generated + "]",
				"".contentEquals(generated));
	}

	@Test
	public void testInvalidMissingPrefixDefaultExtendsClauseGeneratorString()
			throws GeneratorException
	{
		// missing prefix 'import '
		String input = "Test";

		Generator generator = new DefaultExtendsClauseGenerator(input);
		
		StringBuffer generated = generator.generate();

		LOGGER.debug("generated [" + generated + "]");

		assertTrue(
				"unexpected extends [" + generated + "]",
				("extends " + input).contentEquals(generated));
	}
}